package com.ruoyi.LostDevices.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.LostDevices.mapper.LostDevicesMapper;
import com.ruoyi.LostDevices.domain.LostDevices;
import com.ruoyi.LostDevices.service.ILostDevicesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Arrays;

/**
 * 遗失物品Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-19
 */
@Service
public class LostDevicesServiceImpl extends ServiceImpl<LostDevicesMapper, LostDevices> implements ILostDevicesService
{
    @Autowired
    private LostDevicesMapper lostDevicesMapper;

    /**
     * 查询遗失物品
     * 
     * @param id 遗失物品主键
     * @return 遗失物品
     */
    @Override
    public LostDevices selectLostDevicesById(Long id)
    {
                return getById(id);
    }

    /**
     * 查询遗失物品列表
     * 
     * @param lostDevices 遗失物品
     * @return 遗失物品
     */
    @Override
    public List<LostDevices> selectLostDevicesList(LostDevices lostDevices)
    {
        return lostDevicesMapper.selectLostDevicesList(lostDevices);
    }

    /**
     * 新增遗失物品
     * 
     * @param lostDevices 遗失物品
     * @return 结果
     */
    @Override
    public int insertLostDevices(LostDevices lostDevices)
    {
        lostDevices.setCreateTime(DateUtils.getNowDate());
                return save(lostDevices) ? 1 : 0;
    }

    /**
     * 修改遗失物品
     * 
     * @param lostDevices 遗失物品
     * @return 结果
     */
    @Override
    public int updateLostDevices(LostDevices lostDevices)
    {
        lostDevices.setUpdateTime(DateUtils.getNowDate());
                return updateById(lostDevices) ? 1 : 0;
    }

    /**
     * 批量删除遗失物品
     * 
     * @param ids 需要删除的遗失物品主键
     * @return 结果
     */
    @Override
    public int deleteLostDevicesByIds(Long[] ids)
    {
                return removeByIds(Arrays.asList(ids)) ? 1 : 0;
    }

    /**
     * 删除遗失物品信息
     * 
     * @param id 遗失物品主键
     * @return 结果
     */
    @Override
    public int deleteLostDevicesById(Long id)
    {
                return removeById(id) ? 1 : 0;
    }
}
